import serve from './../Base/Http.js'
import qs from 'qs'
// 数据列表
export default {
    comments() {
        return serve({
            method: 'get',
            params: {
                _gp: "admin.freight",
                _mt: "getAllFreightTemplate",
            }
        })
    },
     // 添加
     addition(ruleForm,site) {
        return serve({
            method: 'post',
            data: qs.stringify({
                _gp: "admin.freight",
                _mt: "addFreightTemplate",
                templateName:ruleForm.templateName,//模板名称
                deliveryDeadline:ruleForm.deliveryDeadline,//发货期限
                defaultFreePrice:ruleForm.defaultFreePrice,//默认满价包邮系列
                defaultFirstNum:ruleForm.defaultFirstNum,//默认首费
                defaultFirstPrice:ruleForm.defaultFirstMoney,//默认首件数量/
                defaultContinueNum:ruleForm.defaultContinueNum,//默认续费
                defaultContinuePrice:ruleForm.defaultContinueMoney,//默认续件数量/
                spuLocation:ruleForm.spuLocation,//宝贝地址 
                freightTemplateCarriageDOList:JSON.stringify(
                    ruleForm.freightTemplateCarriageDOList
                )
            })
        })
    },
    // 编辑
    compile(ruleForm,site) {
        return serve({
            method: 'post',
            data: qs.stringify({
                _gp: "admin.freight",
                _mt: "updateFreightTemplate",
                templateId:ruleForm.id,
                templateName:ruleForm.templateName,//模板名称
                deliveryDeadline:ruleForm.deliveryDeadline,//发货期限
                defaultFreePrice:ruleForm.defaultFreePrice,//默认满价包邮系列
                defaultFirstNum:ruleForm.defaultFirstNum,//默认首费
                defaultFirstPrice:ruleForm.defaultFirstMoney,//默认首件数量/
                defaultContinueNum:ruleForm.defaultContinueNum,//默认续费
                defaultContinuePrice:ruleForm.defaultContinueMoney,//默认续件数量/
                spuLocation:ruleForm.spuLocation,//宝贝地址 
                freightTemplateCarriageDOList:JSON.stringify(
                    ruleForm.freightTemplateCarriageDOList,//特殊运费区
                )
            })
        })
    },
    //删除
    handleDeletec(data) {
        return serve({
            method: 'post',
            params:
                {
                    _gp: "admin.freight",
                    _mt: "deleteFreightTemplate",
                    ...data
                }
            
        })
    },
}